from django.core.mail import EmailMultiAlternatives


def send_active_email(token,email):
    """发送激活邮件"""
    subject = '北网易购用户激活'
    from_email = 'shangtiannan@163.com'
    to = email
    text_content = 'Hi!'
    html_content = '<p> 点击下面的链接，激活您的用户</p>'
    link = '<a href="http://127.0.0.1:8000/account/active/{token}/">{token}</a>'.format(token=str(token,encoding='utf8'))
    html_content +=link
    msg = EmailMultiAlternatives(subject,text_content,from_email,[to])
    msg.attach_alternative(html_content,"text/html")
    msg.send()

if __name__ == '__main__':
    pass
